package com.dmpp.mes.controller;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.parameterInfo.Color;
import com.dmpp.mes.parameterInfo.RawMaterial;
import com.dmpp.mes.service.ColorService;
import com.dmpp.mes.service.RawMaterialService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("RawMaterial")
public class RawMaterialController {
//原材料编码
    @Autowired
    private RawMaterialService service;


    @RequestMapping(value = "/FindAll", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findAll(Integer page, Integer pageSize,RawMaterial rawMaterial) {
        PageHelper.startPage(page, pageSize);
        return service.findAll(rawMaterial);
    }

    @RequestMapping(value = "/FindById", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findById(String id) {
        return service.findById(id);
    }

    @RequestMapping(value = "/Insert", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData insert(RawMaterial rawMaterial) {
        return service.insert(rawMaterial);
    }

    @RequestMapping(value = "/UpdateById", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateById(RawMaterial rawMaterial) {
        return service.updateById(rawMaterial);
    }

    @RequestMapping(value = "/DeleteById", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData deleteById(String id) {
        return service.deleteById(id);
    }

    @RequestMapping(value = "/Altogether", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData altogether(RawMaterial rawMaterial) {
        return service.altogether(rawMaterial);
    }
}
